﻿@page "/xlsio/attendance-tracker"
@inject Microsoft.JSInterop.IJSRuntime JS
@using System.IO;

@using Syncfusion.Blazor.Buttons
@inherits SampleBaseComponent;

@*Hidden:Lines*@

@using BlazorDemos.Data.FileFormats.XlsIO

@*End:Hidden*@

<SampleDescription>
  <p>This sample demonstrates how to use AttendanceTracker in spreadsheets using XlsIO.</p>  
</SampleDescription>
<ActionDescription>
   <p>Attendance Tracker or Attendance sheet is essential to any organization. This Attendance tracker is designed to keep one month data. In this application, Employee Name, Supervisor, Present Count, Absent Count, Leave Count, Unplanned%, Planned% and dates for a particular month are available.</p>
<p style='display: block'><b>Features:</b></p>
<p>Essential XlsIO supports Attendance Tracker application features. This sample demonstrates the following features:</P>
<ul>
<li>Conditional formatting</li>
<li>Advanced options of Excel--such as color scales, data bars</li>
<li>Number formats</li>
<li>Formulas</li>
<li>Text styles (bold, italic, underline, font name, and font color)</li>
</ul>
</ActionDescription>

<div class="control-section">
    <p style="font-weight:normal">Click the button to view an Excel spreadsheet generated by Essential XlsIO. Please note that Microsoft Excel Viewer or Microsoft Excel is required to view the resultant document.</p>

    <div class="button-section">
        <div id="button-control">
            <div class="row">
                <div>
                    <SfButton @onclick="AttendanceTrackerXlsIO">Create Document</SfButton>
                </div>
            </div>
        </div>
    </div>
</div>

<style>
    .control-section .row {
        margin: 10px 0;
    }
</style>

@code {
    MemoryStream excelStream;

    /// <summary>
    /// Create and download the Excel document with attendance tracker
    /// </summary>
    public async Task AttendanceTrackerXlsIO()
    {
        AttendanceTrackerService service = new AttendanceTrackerService();
        excelStream = service.AttendanceTrackerXlsIO();
        await JS.SaveAs("Sample.xlsx", excelStream.ToArray());
    }
}